//添加数据

const Book = require('./mydb').Book;
const Reader = require('./mydb').Reader;
async function addBook() {
    const result = await Book.create({
            isbn: "19301041",
            name: 'swagger',
            author: '向向向',
            press: '清华出版社',
            price: '99.00',
            readers: [{
                name: '小向',
                mobile: '13419171453'
            }]
        }, { include: [Reader] } //指定关联关系，读者数据自动插入到读者表
    );
    return result;
}
addBook().then(data => {
    console.log("添加的数据:", JSON.stringify(data, null, 4)); // 获取返回的内容
}).catch(error => {
    console.log(error); // 捕获错误
});